package com.acmen.ump.adminapi.response;

import com.acmen.ump.entity.sys.SysMenu;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Acmen
 * @ClassName MenuTreeDto.java
 * @Description 菜单树结构dto，用于生成前端菜单树
 * @CreateTime 2019年09月01日 14:05:10
 */
@Data
public class MenuTreeDto {
    /**
     * 标题
     */
    private String title;
    /**
     * 是否展开直子节点
     */
    private Boolean expand;
    /**
     * 禁掉响应
     */
    private Boolean disabled;
    /**
     * 禁掉 checkbox
     */
    private Boolean disableCheckbox;
    /**
     * 是否选中子节点
     */
    private Boolean selected;
    /**
     * 是否勾选(如果勾选，子节点也会全部勾选)
     */
    private Boolean checked;
    /**
     * 子节点属性数组
     */
    private List<MenuTreeDto> children;
    /**
     * 数据
     */
    private SysMenu data;

    public MenuTreeDto(){
        this.selected = false;
        this.expand = false;
        this.disabled = false;
        this.disableCheckbox = false;
        this.checked = false;
        this.children = new ArrayList<>();
    }

    public MenuTreeDto(String title){
        this.title = title;
        this.selected = false;
        this.expand = false;
        this.disabled = false;
        this.disableCheckbox = false;
        this.checked = false;
        this.children = new ArrayList<>();
    }

    public MenuTreeDto(SysMenu sysMenu){
        this.title = sysMenu.getDisplayName();
        this.selected = false;
        this.expand = false;
        this.disabled = false;
        this.disableCheckbox = false;
        this.checked = false;
        this.children = new ArrayList<>();
        this.setData(sysMenu);
    }

}
